<?php
/**
 * Created by PhpStorm.
 * User: lenovo
 * Date: 2018/11/8
 * Time: 17:53
 */
header('Content-Type:text/html;charset=utf-8');
if(!defined('ROOT_PATH')){
    define('ROOT_PATH', dirname(__FILE__));
}
require(ROOT_PATH."/define.php");
if (empty($_GET['str'])){
    die('未传参数');
}
$a = $_GET['str'];
//测试数据
$a = 36;
$db = new mysqli($db_host_cs, $db_user_cs, $db_pass_cs, $db_name_cs);
//连接数据库判断
if ($db->connect_error) {
    die("连接失败: " . $db->connect_error);
}
//查询数据库匹配数据
$sql = "select createtime from iw_admin WHERE id ='".$a." '";
$result = $db->query($sql);
if(!$result){
    die('查询数据失败' . $db->connect_error);
}
if ($result->num_rows > 0){
    $row = $result->fetch_assoc();
    if($row['createtime'] ==0){
        die("error：该数据来源有误");
    }
    $time = time();
    $mm=5*60;//PHP的时间是按秒算的
    $time5 = $time-$mm;
     if($row['createtime']>$time5){
         $db->close();
         die('五分钟以内');
     }else{
         $db->close();
         die('超时');
     }
}else{
    die("暂无数据");
}
print_r($row);
$db->close();